<?php

function ListAllNews()
{
    global $dbsql,$language;
    
    $sql_where  = " from tblnews_content where iStatus=1 and cLanguage='$language' ";
    
    $sql_select = "select count(iId) as count ".$sql_where;
    $result     = $dbsql->query_fetch($sql_select);  
    $countall   = $result['count'];
    list($lf,$la)= Split_Page($countall);
    
    $sql_select = "select * ".$sql_where. " order by iId desc ";
    $rs         = $dbsql->query($sql_select);
    $rows       = $dbsql->num_rows($rs);
    $return     = '<div class="ajaxpage">';
    while($result=$dbsql->fetch_array($rs))
    {
        $link    = GetLinkNews($result['iParentId'],$result['cUrlString']);
        $return .= '<a class="listtour" href="'.$link.'" title="'.$result['cName'].'">';
        $return .= '<span class="img"><img src="'.GetIntroImg($result['cImage'],true).'" width="155" alt="'.$result['cName'].'" /></span>';
        
        $return .= '<span class="tt">'.$result['cName'];
        $return .= '<span class="d">'.$result['cDays'].'<br />'.$result['cPriceFrom'].'</span></span>';
        $return .= '<span class="w">'.$result['cHighLights'].'</span>';    
        
        $return .= '<span class="l"></span>';
        $return .= '<span class="f">'.getLang('Find out more').'</span>';        
        $return .= '</a>';
    }   
    $return     .= "<div class='clear'>&nbsp;</div></div>";
    return $return;   
}

function GetLinkNews($idP,$url)
{
    global $dbsql,$language;
    
    $sql_select = "select cUrlString from tblcategory where iId=$idP";
    $result     = $dbsql->query_fetch($sql_select);
    
    return getUrlCatByType('news').'/'.$result['cUrlString'].'/'.$url.'.htm';
}
?>